package edu.drexel.jrexel2d.animation;

import java.io.IOException;

import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;

public class SpriteSheet {
	private String name ;
	private boolean bounce ;
	private Texture sheet ;
	private int numFrames ;
	private int width ;
	private int height ;

	public SpriteSheet(String folder, String sheetName, Boolean b, int x, int y) {
		try {
			sheet = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("assets/sprites/" + folder + "/" + sheetName + ".png"));
		}
		catch(IOException e) {
			System.out.println("Error loading textures for " + name + ": " + e) ;
			// Do Something
		}
		
		numFrames = (sheet.getImageWidth() / x) * (sheet.getImageHeight() / y) ;
		this.name = sheetName ;
		width = x ;
		height = y ;
		bounce = b ;
	}
	
	public Texture getTex() {
		return sheet ;
	}
	
	public String getName() {
		return name ;
	}
	
	public int getWidth() {
		return width ;
	}
	
	public int getHeight() {
		return height ;
	}
	
	public Boolean getBounce() {
		return bounce ;
	}
	
	public int numFrames() {
		return numFrames ;
	}
}
